package com.maslyk.invitation.entitybean;

import java.math.BigDecimal;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.maslyk.invitation.audit.ObjectName;
import com.maslyk.invitation.entitybean.abstrct.EntityList;
import com.maslyk.invitation.entitybean.abstrct.GenericEntity;
@Entity
@Table(name = "priceparameter")
@ObjectName(label="Definicja prowizji")
public class PriceParameter implements GenericEntity
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
    /**
     * nazwa oplaty
     */
    @Column(name = "name")
	private String name;
	
    /**
     * cena jednostkowa oplaty
     */
	@Column(name = "price")
	private BigDecimal price;
	
	@OneToMany(mappedBy="priceparameter", fetch=FetchType.LAZY)
	private List<FeeInvitation> feeList = new EntityList<FeeInvitation>();
	
	public Integer getId()
	{
		return id;
	}

	public void setId(Integer id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public BigDecimal getPrice()
	{
		return price;
	}

	public void setPrice(BigDecimal price)
	{
		this.price = price;
	}
	
	public static String getBeanName()
	{
		return "priceParameter";
	}

	public List<FeeInvitation> getFeeList()
	{
		return feeList;
	}

	public void setFeeList(List<FeeInvitation> feeList)
	{
		this.feeList = feeList;
	}

	public String getKey() {
		return null;
	}

	@Override
	protected Object clone() throws CloneNotSupportedException {
		PriceParameter pp = (PriceParameter) super.clone(); 
		setId(null);
		return pp;
	}
	
	public boolean isInserted() {
		return id != null;
	}
}